﻿// -----------------------------------------------------------------------
// <copyright file="KeyboardListener.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.Player
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class KeyboardListener : System.Windows.Forms.IMessageFilter
    {
        /// <summary>
        /// Initializes a new instance of the MessageFilter class.
        /// </summary>
        public KeyboardListener()
        {
        }

        /// <summary>
        /// Filter messages and call methods associated with the pressed key
        /// </summary>
        /// <param name="m">The message received</param>
        /// <returns>Returns false?</returns>
        [System.Diagnostics.DebuggerStepThrough()]
        public bool PreFilterMessage(ref System.Windows.Forms.Message m)
        {
            if (m.Msg == 256 /*0x0100*/)
            {
                switch (((int)m.WParam) | ((int)Control.ModifierKeys))
                {
                    ////case (int)(Keys.Control | Keys.Alt | Keys.K):
                    ////    System.Windows.Forms.MessageBox.Show("You pressed ctrl + alt + k");
                    ////    break;

                    case (int)Keys.J:
                        Playlist.PlaylistLogic.Instance.SearchItem();
                        break;

                    ////case (int)(Keys.Control | Keys.C): System.Windows.Forms.MessageBox.Show("You pressed ctrl+c");
                    ////    break;
                    ////case (int)(Keys.Control | Keys.V): System.Windows.Forms.MessageBox.Show("You pressed ctrl+v");
                    ////    break;
                    ////case (int)Keys.Up: System.Windows.Forms.MessageBox.Show("You pressed up");
                    ////    break;
                }
            }

            return false;
        }
    }
}
